package edu.gdkm.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import edu.gdkm.pojo.Resume;
import org.springframework.stereotype.Repository;


@Repository
public interface ResumeDao {
    @Select("select * from resume where id=#{id}")
    Resume findById(Integer id);

    @Select("select * from resume")
    Resume[] findAll();

    @Insert("insert into resume(user_id,resume_name,template_id,education_experience,work_experience,project_experience,skills,certificates,hobbies,language_ability,internship_experience,visibility,create_time,update_time) values(#{userId},#{resumeName},#{templateId},#{educationExperience},#{workExperience},#{projectExperience},#{skills},#{certificates},#{hobbies},#{languageAbility},#{internshipExperience},#{visibility},#{createTime},#{updateTime})")
    boolean save(Resume resume);

    @Update("update resume set resume_name=#{resumeName},template_id=#{templateId},education_experience=#{educationExperience},work_experience=#{workExperience},project_experience=#{projectExperience},skills=#{skills},certificates=#{certificates},hobbies=#{hobbies},language_ability=#{languageAbility},internship_experience=#{internship_experience},visibility=#{visibility},create_time=#{createTime},update_time=#{updateTime} where id=#{id}")
    boolean update(Resume resume);

    @Delete("delete from resume where id= #{id}")
    boolean delete(Integer id);
}
